import sensor,image,lcd  # import 相关库
import utime
import time
import uart
import gpio
import face_recognition

clock = time.clock()  # 初始化系统时钟，计算帧率

def Initialization():
    lcd.init() # 初始化lcd
    sensor.reset() #初始化sensor 摄像头
    sensor.set_pixformat(sensor.RGB565)
    sensor.set_framesize(sensor.QVGA)
    sensor.set_hmirror(0) #设置摄像头镜像
    sensor.set_vflip(1)   #设置摄像头翻转
    sensor.run(1) #使能摄像头

    uart.uart_init()
    gpio.gpioInit()
    face_recognition.faceInit()

def main():
    Initialization()
    while(1):
        clock.tick()
        img = sensor.snapshot()
        gpio.ID_out.value(0)
        face_recognition.faceRecog(img)
        pass

main()
